<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button onclick="saveDate()">点击添加历史</button>
    <button onclick="getDate()">获取历史</button>
    <button onclick="deleteDate()">删除历史</button>
    <button onclick="clearDate()">清空历史</button>
</body>
<script>
    function saveDate(){
        sessionStorage.setItem('msg', 'hello world')
    }
    function getDate(){
        const msg = sessionStorage.getItem('msg')
        alert(msg)
    }
    function deleteDate(){
        sessionStorage.removeItem('msg')
    }
    function clearDate(){
        sessionStorage.clear()
    }
</script>
</html>